package dao.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "rewrite", catalog = "makeiteasy")
public class Rewrite implements java.io.Serializable {

	// Fields
	private static final long serialVersionUID = 1L;
	private Integer rewriteId;
	private String rewriteDirection;
	private String rewriteTitle;
	private String rewriteKeys;
	private Set<Test> tests = new HashSet<Test>(0);

	// Constructors

	/** default constructor */
	public Rewrite() {
	}

	/** full constructor */
	public Rewrite(String rewriteDirection, String rewriteTitle,
			String rewriteKeys, Set<Test> tests) {
		this.rewriteDirection = rewriteDirection;
		this.rewriteTitle = rewriteTitle;
		this.rewriteKeys = rewriteKeys;
		this.tests = tests;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "rewriteId", unique = true, nullable = false)
	public Integer getRewriteId() {
		return this.rewriteId;
	}

	public void setRewriteId(Integer rewriteId) {
		this.rewriteId = rewriteId;
	}

	@Column(name = "rewriteDirection", length = 128)
	public String getRewriteDirection() {
		return this.rewriteDirection;
	}

	public void setRewriteDirection(String rewirteDirection) {
		this.rewriteDirection = rewirteDirection;
	}

	@Column(name = "rewriteTitle", length = 512)
	public String getRewriteTitle() {
		return this.rewriteTitle;
	}

	public void setRewriteTitle(String rewriteTitle) {
		this.rewriteTitle = rewriteTitle;
	}

	@Column(name = "rewriteKeys", length = 512)
	public String getRewriteKeys() {
		return this.rewriteKeys;
	}

	public void setRewriteKeys(String rewriteKeys) {
		this.rewriteKeys = rewriteKeys;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "rewrite")
	public Set<Test> getTests() {
		return this.tests;
	}

	public void setTests(Set<Test> tests) {
		this.tests = tests;
	}

}